<template>
	<view>
		<view class="tabs">
			<view class="tab-item" v-for="(item,index) in list1" :key="index" @click="hah(item,index)">
				<view :class="['tab-item', { selected: selectedIndices == index ? 'selected':''}]">
					{{ item.name }}
				</view>
			</view>
		</view>

		<view class="cenbox" :style="{ height: windowHeight }" v-if="selectedIndices == 0">

			<view class="itembox">
				<view class="neige">
					<view class="leftqiu">

					</view>
					<view class="rightqiu">

					</view>

					<view class="boxone">
						<view class="num">
							1天
						</view>
						<view class="chouc">
							免抽成
						</view>
					</view>
					<view class="line">

					</view>
					<view class="boxtwo">
						<view class="toptxt">
							[跑腿专用]接单免抽券
						</view>
						<view class="bomtxt">
							有效期:2017.03.10 到期
						</view>
					</view>
					<view class="boxthree">
						<view class="btn">
							立即使用
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="cenbox1" :style="{ height: windowHeight }" v-if="selectedIndices == 1">
			<view class="itembox">
				<view class="neige">
					<view class="leftqiu">

					</view>
					<view class="rightqiu">

					</view>

					<view class="boxone">
						<view class="num">
							1天
						</view>
						<view class="chouc">
							免抽成
						</view>
					</view>
					<view class="line">

					</view>
					<view class="boxtwo">
						<view class="toptxt">
							[跑腿专用]接单免抽券
						</view>
						<view class="bomtxt">
							有效期:2017.03.10 到期
						</view>
					</view>
					<view class="boxthree">
						<view class="btn">
							已使用
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="cenbox1" :style="{ height: windowHeight }" v-if="selectedIndices == 2">
			<view class="itembox">
				<view class="neige">
					<view class="leftqiu">

					</view>
					<view class="rightqiu">

					</view>

					<view class="boxone">
						<view class="num">
							1天
						</view>
						<view class="chouc">
							免抽成
						</view>
					</view>
					<view class="line">

					</view>
					<view class="boxtwo">
						<view class="toptxt">
							[跑腿专用]接单免抽券
						</view>
						<view class="bomtxt">
							有效期:2017.03.10 到期
						</view>
					</view>
					<view class="boxthree">
						<view class="btn">
							已过期
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	var app = getApp( );
	import ikz from '@/pages/Common/tools.js';
	export default {
		data( ) {
			return {
				list1: [ {
					name: '待使用'
				}, {
					name: '已使用'
				}, {
					name: '已过期'
				}, ],
				selectedIndices: 0,
				windowHeight: 0,
				page: 1,
				business_id: ''
			};
		},
		onLoad( ) {
			var _this = this
			uni.getSystemInfo( {
				success: function( res ) {
					console.log( res.windowHeight, 'sssssssss' );
					_this.windowHeight = res.windowHeight - 58 + 'px';
					console.log( _this.windowHeight, '_this.windowHeight ' );
				}
			} )
		},
		onShow( ) {
			this.getlist( )
		},
		methods: {
			hah( item, index ) {
				console.log( index, '每一项' );
				this.selectedIndices = index
				this.getlist( )
			},
			getlist( ) {
				var path = '/coupon/userList';
				if(this.business_id){
					var data = {
						business_id: this.business_id,
						status: this.selectedIndices,
						page: this.page
					}
				}else{
					var data = {
						status: this.selectedIndices,
						page: this.page
					}
				}
				
				ikz.get( path, data, res => {
					console.log( res, 'ssssss' );
					if ( res.data.code ) {
						this.leixing = res.data.data.supermarket_category_list

					} else {
						uni.showModal( {
							title: '提示',
							content: res.data.msg,
							showCancel: false,
							success: function( res ) {}
						} );
					}
				} );
			},
		},
	}
</script>

<style lang="scss">
	.tabs {
		width: 750rpx;
		height: 82rpx;
		background: #FFFFFF;
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 86rpx;
		box-sizing: border-box;

		.tab-item {
			width: 110rpx;
			height: 82rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			color: #AFAFAF;
			background: #FFFFFF;

			.selected {
				/* 选中时的样式，比如背景色为红色 */
				color: #000000;
				border-bottom: 4rpx solid #247EFF;
			}
		}
	}

	.cenbox {
		padding: 28rpx 28rpx;
		box-sizing: border-box;

		.itembox {
			width: 690rpx;
			height: 192rpx;
			background: linear-gradient(90deg, #FFA83D 0%, #F24444 100%);
			border-radius: 30rpx 30rpx 30rpx 30rpx;
			padding: 18rpx;
			box-sizing: border-box;

			.neige {
				width: 650rpx;
				height: 159rpx;
				background: linear-gradient(90deg, #FFEFD6 0%, #FFFAF2 66%, #ECD6BC 100%);
				border-radius: 30rpx 30rpx 30rpx 30rpx;
				position: absolute;
				display: flex;
				align-items: center;
				justify-content: space-around;
				padding: 24rpx 40rpx 24rpx 26rpx;
				box-sizing: border-box;

				.leftqiu {
					width: 35rpx;
					height: 35rpx;
					background-color: #FFA63D;
					border-radius: 50%;
					position: absolute;
					left: -12rpx;
					top: 70rpx;
				}

				.line {
					width: 0rpx;
					height: 80rpx;
					border: 1rpx solid #F24544;
				}

				.rightqiu {
					width: 35rpx;
					height: 35rpx;
					background-color: #F24544;
					border-radius: 50%;
					position: absolute;
					right: -12rpx;
					top: 70rpx;
				}

				.boxone {
					width: 84rpx;
					height: 100%;

					.num {
						width: 100%;
						height: 58rpx;
						font-weight: bold;
						font-size: 40rpx;
						color: #F24544;
						text-align: center;
					}

					.chouc {
						width: 100%;
						height: 40rpx;
						font-weight: 400;
						font-size: 28rpx;
						color: #AFAFAF;
						text-align: center;
						margin-top: 12rpx;
					}
				}

				.boxtwo {
					width: 322rpx;
					height: 100%;
					display: flex;
					flex-direction: column;
					justify-content: space-between;
					align-items: flex-start;

					.toptxt {
						width: 100%;
						height: 48rpx;
						font-weight: bold;
						font-size: 32rpx;
						color: #F24544;
						text-align: left;
					}

					.bomtxt {
						width: 100%;
						height: 36rpx;
						font-weight: 400;
						font-size: 24rpx;
						color: #F24544;
						text-align: left;
					}

				}

				.boxthree {
					width: 124rpx;
					height: 100%;

					.btn {
						width: 124rpx;
						height: 44rpx;
						border-radius: 8rpx 8rpx 8rpx 8rpx;
						border: 2rpx solid #F24544;
						font-weight: 400;
						font-size: 24rpx;
						color: #F24544;
						text-align: center;
						line-height: 44rpx;
						margin-top: 30rpx;
					}
				}
			}
		}
	}

	.cenbox1 {
		padding: 28rpx 28rpx;
		box-sizing: border-box;

		.itembox {
			width: 690rpx;
			height: 192rpx;
			background: linear-gradient(90deg, #AFAFAF 0%, #666666 100%);
			border-radius: 30rpx 30rpx 30rpx 30rpx;
			padding: 18rpx;
			box-sizing: border-box;

			.neige {
				width: 650rpx;
				height: 159rpx;
				background-color: #fff;
				border-radius: 30rpx 30rpx 30rpx 30rpx;
				position: absolute;
				display: flex;
				align-items: center;
				justify-content: space-around;
				padding: 24rpx 40rpx 24rpx 26rpx;
				box-sizing: border-box;

				.leftqiu {
					width: 35rpx;
					height: 35rpx;
					background-color: #ADADAD;
					border-radius: 50%;
					position: absolute;
					left: -12rpx;
					top: 70rpx;
				}

				.line {
					width: 0rpx;
					height: 80rpx;
					border: 1rpx solid #AFAFAF;
				}

				.rightqiu {
					width: 35rpx;
					height: 35rpx;
					background-color: #676767;
					border-radius: 50%;
					position: absolute;
					right: -12rpx;
					top: 70rpx;
				}

				.boxone {
					width: 84rpx;
					height: 100%;

					.num {
						width: 100%;
						height: 58rpx;
						font-weight: bold;
						font-size: 40rpx;
						color: #AFAFAF;
						text-align: center;
					}

					.chouc {
						width: 100%;
						height: 40rpx;
						font-weight: 400;
						font-size: 28rpx;
						color: #AFAFAF;
						text-align: center;
						margin-top: 12rpx;
					}
				}

				.boxtwo {
					width: 322rpx;
					height: 100%;
					display: flex;
					flex-direction: column;
					justify-content: space-between;
					align-items: flex-start;

					.toptxt {
						width: 100%;
						height: 48rpx;
						font-weight: bold;
						font-size: 32rpx;
						color: #AFAFAF;
						text-align: left;
					}

					.bomtxt {
						width: 100%;
						height: 36rpx;
						font-weight: 400;
						font-size: 24rpx;
						color: #AFAFAF;
						text-align: left;
					}

				}

				.boxthree {
					width: 124rpx;
					height: 100%;

					.btn {
						width: 124rpx;
						height: 44rpx;
						font-weight: 400;
						font-size: 24rpx;
						color: #AFAFAF;
						text-align: center;
						line-height: 44rpx;
						margin-top: 30rpx;
					}
				}
			}
		}
	}
</style>